<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base herf="<%=basePath%>">
<link href="<%=basePath%>static2/assets/css/bootstrap.min.css"
	rel="stylesheet" />
<link rel="stylesheet" href="<%=basePath%>static2/css/style.css" />
<link href="<%=basePath%>static2/assets/css/codemirror.css"
	rel="stylesheet">
<link rel="stylesheet"
	href="<%=basePath%>static2/assets/css/ace.min.css" />
<link rel="stylesheet"
	href="<%=basePath%>static2/assets/css/font-awesome.min.css" />
<link rel="stylesheet" href="<%=basePath%>layui/css/layui.css"
	media="all">
<script src="<%=basePath%>static2/assets/js/jquery.min.js"></script>
<script type="text/javascript">
			window.jQuery || document.write("<script src='<%=basePath%>static2/assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>
<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='<%=basePath%>static2/assets/js/jquery.mobile.custom.min.js'>"
						+ "<"+"/script>");
</script>
<script src="<%=basePath%>static2/assets/js/bootstrap.min.js"></script>
<script src="<%=basePath%>static2/assets/js/typeahead-bs2.min.js"></script>
<!-- page specific plugin scripts -->
<script src="<%=basePath%>static2/assets/js/jquery.dataTables.min.js"></script>
<script
	src="<%=basePath%>static2/assets/js/jquery.dataTables.bootstrap.js"></script>
<script type="text/javascript" src="<%=basePath%>static2/js/H-ui.js"></script>
<script type="text/javascript"
	src="<%=basePath%>static2/js/H-ui.admin.js"></script>
<script src="<%=basePath%>static2/assets/layer/layer.js"
	type="text/javascript"></script>
<script src="<%=basePath%>static2/assets/laydate/laydate.js"
	type="text/javascript"></script>
<script src="<%=basePath%>layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
function doUpload() {
    var formData = new FormData($("#uploadForm")[0]);
    $.ajax({
    url: 'http://localhost:8080/moyissm/categroy/uploadCate',
    type: 'POST',
    data: formData,
    async: false,
    cache: false,
    contentType: false,
    processData: false,
    success: function (returndata) {
        alert("上传成功");
    },
    error: function (returndata) {
        alert("上传ok");
    }
    });
}

function tijiao(){
	//获取一个上传文件的扩展名
	var myfile = document.getElementById('imgName');
	var name=$("#imgName").val();
	//alert(name);
	
	var catename =$("#catename").val();
	
	
	//获取文件上传文件的文件名和扩展名
	if(myfile.files[0] == undefined){
		alert('未上传文件！');
	}else{
		//获取上传文件的文件名
		alert(myfile.files[0].name);
	}

	//获取上传文件的扩展名
	var filevalue = myfile.value;
	var index = filevalue.lastIndexOf('.');
	//alert(filevalue.substring(index));
	
	name = myfile.files[0].name;
	window.location.href = "http://localhost:8080/moyissm/categroy/addCate?imgPath="+name+"&catename="+catename;
}

</script>
<title>用户列表</title>
</head>

<body>
	<!--添加用户图层-->
	<div class="add_menber" id="add_menber_style">
			
				<label class="label_name">类&nbsp;&nbsp; 型&nbsp;名：</label><span
					class="add_name"><input value="" name="catename" type="text"
						id="catename" class="text_add" /></span>
					<div class="prompt r_f"></div>
				
			
			<div style="height: 120"></div>
			
		<hr class="layui-bg-cyan">
		
		<div align="center" style="text-align: center">
			<form id="uploadForm" enctype="multipart/form-data">
			  上传图片： <input type="file" name="file" id="imgName"/>
			  <input type="button" value="上传" onclick="doUpload()" />
			  <input type="button" value="添加类型" onclick="tijiao()" />
			</form>
		</div>
		
</div>   
	</div>
	
	
</body>
</html>
